<?php
namespace Register\Form;

use Zend\Form\Form;


class RegisterForm extends Form 
{
    
    public function __construct($name = null)
    {
        parent::__construct('register');
        $this->setAttribute('method', 'post');
        $this->setAttribute('class', 'form-horizontal');
        $this->setInputFilter(new RegisterFormFilter());
        
        /* Add select for pending Events */
        
        $this->add(array(
            'name' => 'PENDINGEVENT',
            'options' => array(
                'label' => 'Title:',
                'empty_option' => '--select an event--',
                'disable_inarray_validator' => true
            ),
            'type' => 'Select',
            'attributes' => array(
                'class' => 'form-control',
                'id' =>'pendingEvent'
                
            )
        ));
        
        $this->add(array(
            'name' => 'ID',
            'type' => 'Hidden',
            array(
                'default' => '2'
            ),
            'attributes' => array(
                'id' =>'ID'
            
            )
        ));
        
        $this->add(array(
            'name' => 'PHONE',
            'required' => true,
            
            'options' => array(
                'label' => 'Phone :'
            ),
            'type' => 'Text',
            'attributes' => array(
                'class' => 'form-control',
                'id' =>'PHONE'
            ),
            
        ));
        
        $this->add(array(
            'name' => 'BTNADDPHONE',
            'options' => array(
                'label' => ''
            ),
            'attributes' => array(
                'value' => '+',
                'class' => 'btn btn-info',
                'disabled' => 'disabled'
            ),
            'type' => 'submit',
            'id' => 'submitbutton'
        ));
        
        $this->add(array(
            'name' => 'TITLE',
            'options' => array(
                'label' => 'Title :'
            ),
            'type' => 'Zend\Form\Element\Select',
            'attributes' => array(
                'class' => 'form-control',
                'style' => 'width:125px',
                'id' => 'TITLE',
                'options' => array(
                    '0' => '--select--',
                    '1' => 'Rev',
                    '2' => 'Ps',
                    '3' => 'Mr',
                    '4' => 'Mrs',
                    '5' => 'Miss',
                    '6' => 'Dr',
                    '7' => 'Prof',
                    '8' => 'Other'
                )                
            ),
            'required' => true
        ));
        
        $this->add(array(
            'name' => 'FIRST_NAME',
            'options' => array(
                'label' => 'First Name :'
            ),
            'type' => 'text',
            'attributes' => array(
                'class' => 'form-control',
                'id' => 'FIRST_NAME',
            )
        ));
        
       $this->add(array(
            'name' => 'MIDDLE_NAME',
            'options' => array(
                'label' => 'Middle Name :'
            ),
            'type' => 'text',
            'attributes' => array(
                'class' => 'form-control',
                'id' => 'MIDDLE_NAME'
            )
        ));
        $this->add(array(
            'name' => 'LAST_NAME',
            'options' => array(
                'label' => 'Last Name :'
            ),
            'type' => 'text',
            'attributes' => array(
                'class' => 'form-control',
                'id' => 'LAST_NAME',
            )
        ));
        
        $this->add(array(            
            'name' => 'GENDER',
            'type' => 'Zend\Form\Element\Radio',
            'options' => array(
                'label' => 'Gender',
                'value_options' => array(
                    '1' => 'Male',
                    '2' => 'Female'
                )
            ),
            'attributes' => array(
                'value' => '1',
                'style' => 'margin-left:0.5em',
                'id' => 'GENDER',
            )
        ) // set checked to '1'

        );
        
        $this->add(array(
            'name' => 'ADDRESS',
            'options' => array(
                'label' => 'Address :',
                
            ),
            'type' => 'Textarea',
            'attributes' => array(
                'class' => 'form-control',
                'style' => 'resize: none',
                'id' => 'ADDRESS',
            )
        ));
        
        $this->add(array(
            'name' => 'EMAIL',
            'options' => array(
                'label' => 'Email :'
            ),
            'type' => 'email',
            'attributes' => array(
                'class' => 'form-control',
                'id' =>'EMAIL'
            )
        ));
        
        $this->add(array(
            'name' => 'BTNADDEMAIL',
            'options' => array(
                'label' => ''
            ),
            'attributes' => array(
                'value' => '+',
                'class' => 'btn btn-info',
                'disabled' => true
            ),
            'type' => 'submit',
            'id' => 'submitbutton'
        ));
        
        $this->add(array(
            'type' => 'Zend\Form\Element\Radio',
            'name' => 'FUNDING',
            'options' => array(
                'label' => 'Funding',
                'value_options' => array(
                    '1' => 'Self',
                    '2' => 'Organization'
                )
            ),
            'attributes' => array(
                'value' => '1',
                'style' => 'margin-left:0.5em',
                'id' => 'FUNDING',
            )
        ) // set checked to '1'

        );
        
        $this->add(array(
            'name' => 'ORGANIZATION',
            'options' => array(
                'label' => 'Organization :'
            ),
            'type' => 'text',
            'attributes' => array(
                'class' => 'form-control',
                'id' => 'ORGANIZATION',
                'disabled' => true
            )
        ));
        
        $this->add(array(
            'name' => 'BTNADD',
            'options' => array(
                'label' => '',
                'inline' => true
            ),
            'attributes' => array(
                'value' => 'Add',
                'class' => 'btn btn-default',
                'id' => 'BTNADD'
            ),
            'type' => 'submit'
        ));
        
        $this->add(array(
            'name' => 'BTNCANCEL',
            'options' => array(
                'label' => 'Cancel',
                'close' => true,
                'inline' => false
            ),
            'attributes' => array(
                'class' => 'btn btn-default'
            ),
            'type' => 'button'
        ));                
      
        
        // We could also define the input filter here, or
        // lazy-create it in the getInputFilter() method.
    } 
 
}